import { IPSAppDEAction } from '../../app/dataentity/ipsapp-deaction';
import { IPSAppDEDataSet } from '../../app/dataentity/ipsapp-dedata-set';
import { IPSAppDEField } from '../../app/dataentity/ipsapp-defield';
import { IPSAppDataEntity } from '../../app/dataentity/ipsapp-data-entity';
import { IPSDETreeDataSetNode } from './ipsdetree-data-set-node';
import { PSDETreeNodeImplBase } from './psdetree-node-impl-base';
import { IPSDEOPPriv } from '../../dataentity/priv/ipsdeoppriv';

export class PSDETreeDataSetNodeImpl extends PSDETreeNodeImplBase implements IPSDETreeDataSetNode {
  protected childcntpsappdefield: IPSAppDEField | null = null;

  getChildCntPSAppDEField(): IPSAppDEField | null {
    if (this.childcntpsappdefield != null) return this.childcntpsappdefield;
    const value = this.M.getChildCntPSAppDEField;
    if (value == null) {
      return null;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.childcntpsappdefield = ipsappdataentity.findPSAppDEField(value);
    }
    return this.childcntpsappdefield;
  }

  get childCntPSAppDEField(): IPSAppDEField | null {
    return this.getChildCntPSAppDEField();
  }

  getChildCntPSAppDEFieldMust(): IPSAppDEField {
    const value = this.getChildCntPSAppDEField();
    if (value == null) {
      throw new Error('未指定节点计数值应用实体属性');
    }
    return value;
  }

  protected clspsappdefield: IPSAppDEField | null = null;

  getClsPSAppDEField(): IPSAppDEField | null {
    if (this.clspsappdefield != null) return this.clspsappdefield;
    const value = this.M.getClsPSAppDEField;
    if (value == null) {
      return null;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.clspsappdefield = ipsappdataentity.findPSAppDEField(value);
    }
    return this.clspsappdefield;
  }

  get clsPSAppDEField(): IPSAppDEField | null {
    return this.getClsPSAppDEField();
  }

  getClsPSAppDEFieldMust(): IPSAppDEField {
    const value = this.getClsPSAppDEField();
    if (value == null) {
      throw new Error('未指定节点样式表值应用实体属性');
    }
    return value;
  }

  get customCond(): string {
    return this.M.customCond;
  }

  protected filterpsappdedataset: IPSAppDEDataSet | null = null;

  getFilterPSAppDEDataSet(): IPSAppDEDataSet | null {
    if (this.filterpsappdedataset != null) return this.filterpsappdedataset;
    const value = this.M.getFilterPSAppDEDataSet;
    if (value == null) {
      return null;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.filterpsappdedataset = ipsappdataentity.findPSAppDEDataSet(value);
    }
    return this.filterpsappdedataset;
  }

  get filterPSAppDEDataSet(): IPSAppDEDataSet | null {
    return this.getFilterPSAppDEDataSet();
  }

  getFilterPSAppDEDataSetMust(): IPSAppDEDataSet {
    const value = this.getFilterPSAppDEDataSet();
    if (value == null) {
      throw new Error('未指定过滤应用实体结果集对象');
    }
    return value;
  }

  protected iconpsappdefield: IPSAppDEField | null = null;

  getIconPSAppDEField(): IPSAppDEField | null {
    if (this.iconpsappdefield != null) return this.iconpsappdefield;
    const value = this.M.getIconPSAppDEField;
    if (value == null) {
      return null;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.iconpsappdefield = ipsappdataentity.findPSAppDEField(value);
    }
    return this.iconpsappdefield;
  }

  get iconPSAppDEField(): IPSAppDEField | null {
    return this.getIconPSAppDEField();
  }

  getIconPSAppDEFieldMust(): IPSAppDEField {
    const value = this.getIconPSAppDEField();
    if (value == null) {
      throw new Error('未指定节点图标值应用实体属性');
    }
    return value;
  }

  protected idpsappdefield: IPSAppDEField | null = null;

  getIdPSAppDEField(): IPSAppDEField | null {
    if (this.idpsappdefield != null) return this.idpsappdefield;
    const value = this.M.getIdPSAppDEField;
    if (value == null) {
      return null;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.idpsappdefield = ipsappdataentity.findPSAppDEField(value);
    }
    return this.idpsappdefield;
  }

  get idPSAppDEField(): IPSAppDEField | null {
    return this.getIdPSAppDEField();
  }

  getIdPSAppDEFieldMust(): IPSAppDEField {
    const value = this.getIdPSAppDEField();
    if (value == null) {
      throw new Error('未指定节点标识值应用实体属性');
    }
    return value;
  }

  protected leafflagpsappdefield: IPSAppDEField | null = null;

  getLeafFlagPSAppDEField(): IPSAppDEField | null {
    if (this.leafflagpsappdefield != null) return this.leafflagpsappdefield;
    const value = this.M.getLeafFlagPSAppDEField;
    if (value == null) {
      return null;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.leafflagpsappdefield = ipsappdataentity.findPSAppDEField(value);
    }
    return this.leafflagpsappdefield;
  }

  get leafFlagPSAppDEField(): IPSAppDEField | null {
    return this.getLeafFlagPSAppDEField();
  }

  getLeafFlagPSAppDEFieldMust(): IPSAppDEField {
    const value = this.getLeafFlagPSAppDEField();
    if (value == null) {
      throw new Error('未指定叶节点标识值应用实体属性');
    }
    return value;
  }

  get maxSize(): number {
    return this.M.maxSize;
  }

  protected psappdedataset: IPSAppDEDataSet | null = null;

  getPSAppDEDataSet(): IPSAppDEDataSet | null {
    if (this.psappdedataset != null) return this.psappdedataset;
    const value = this.M.getPSAppDEDataSet;
    if (value == null) {
      return null;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.psappdedataset = ipsappdataentity.findPSAppDEDataSet(value);
    }
    return this.psappdedataset;
  }

  get psAppDEDataSet(): IPSAppDEDataSet | null {
    return this.getPSAppDEDataSet();
  }

  getPSAppDEDataSetMust(): IPSAppDEDataSet {
    const value = this.getPSAppDEDataSet();
    if (value == null) {
      throw new Error('未指定应用实体结果集对象');
    }
    return value;
  }

  protected psappdataentity: IPSAppDataEntity | null = null;

  getPSAppDataEntity(): IPSAppDataEntity | null {
    if (this.psappdataentity != null) return this.psappdataentity;
    const value = this.M.getPSAppDataEntity;
    if (value == null) {
      return null;
    }
    this.psappdataentity = this.getPSModel4('app.dataentity.IPSAppDataEntity', value, 'getPSAppDataEntity') as IPSAppDataEntity;
    return this.psappdataentity;
  }

  get psAppDataEntity(): IPSAppDataEntity | null {
    return this.getPSAppDataEntity();
  }

  getPSAppDataEntityMust(): IPSAppDataEntity {
    const value = this.getPSAppDataEntity();
    if (value == null) {
      throw new Error('未指定应用实体对象');
    }
    return value;
  }

  protected removepsappdeaction: IPSAppDEAction | null = null;

  getRemovePSAppDEAction(): IPSAppDEAction | null {
    if (this.removepsappdeaction != null) return this.removepsappdeaction;
    const value = this.M.getRemovePSAppDEAction;
    if (value == null) {
      return null;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.removepsappdeaction = ipsappdataentity.findPSAppDEAction(value);
    }
    return this.removepsappdeaction;
  }

  get removePSAppDEAction(): IPSAppDEAction | null {
    return this.getRemovePSAppDEAction();
  }

  getRemovePSAppDEActionMust(): IPSAppDEAction {
    const value = this.getRemovePSAppDEAction();
    if (value == null) {
      throw new Error('未指定删除数据应用实体行为');
    }
    return value;
  }

  protected removepsdeoppriv: IPSDEOPPriv | null = null;

  getRemovePSDEOPPriv(): IPSDEOPPriv | null {
    if (this.removepsdeoppriv != null) return this.removepsdeoppriv;
    const value = this.M.getRemovePSDEOPPriv;
    if (value == null) {
      return null;
    }
    this.removepsdeoppriv = this.getPSModel4('dataentity.priv.IPSDEOPPriv', value, 'getRemovePSDEOPPriv') as IPSDEOPPriv;
    return this.removepsdeoppriv;
  }

  get removePSDEOPPriv(): IPSDEOPPriv | null {
    return this.getRemovePSDEOPPriv();
  }

  getRemovePSDEOPPrivMust(): IPSDEOPPriv {
    const value = this.getRemovePSDEOPPriv();
    if (value == null) {
      throw new Error('未指定删除要求操作标识');
    }
    return value;
  }

  get sortDir(): 'ASC' | 'DESC' {
    return this.M.sortDir;
  }

  protected sortpsappdefield: IPSAppDEField | null = null;

  getSortPSAppDEField(): IPSAppDEField | null {
    if (this.sortpsappdefield != null) return this.sortpsappdefield;
    const value = this.M.getSortPSAppDEField;
    if (value == null) {
      return null;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.sortpsappdefield = ipsappdataentity.findPSAppDEField(value);
    }
    return this.sortpsappdefield;
  }

  get sortPSAppDEField(): IPSAppDEField | null {
    return this.getSortPSAppDEField();
  }

  getSortPSAppDEFieldMust(): IPSAppDEField {
    const value = this.getSortPSAppDEField();
    if (value == null) {
      throw new Error('未指定节点排序值应用实体属性');
    }
    return value;
  }

  get textFormat(): string {
    return this.M.textFormat;
  }

  protected textpsappdefield: IPSAppDEField | null = null;

  getTextPSAppDEField(): IPSAppDEField | null {
    if (this.textpsappdefield != null) return this.textpsappdefield;
    const value = this.M.getTextPSAppDEField;
    if (value == null) {
      return null;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.textpsappdefield = ipsappdataentity.findPSAppDEField(value);
    }
    return this.textpsappdefield;
  }

  get textPSAppDEField(): IPSAppDEField | null {
    return this.getTextPSAppDEField();
  }

  getTextPSAppDEFieldMust(): IPSAppDEField {
    const value = this.getTextPSAppDEField();
    if (value == null) {
      throw new Error('未指定节点文本值属性对象');
    }
    return value;
  }

  protected tipspsappdefield: IPSAppDEField | null = null;

  getTipsPSAppDEField(): IPSAppDEField | null {
    if (this.tipspsappdefield != null) return this.tipspsappdefield;
    const value = this.M.getTipsPSAppDEField;
    if (value == null) {
      return null;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.tipspsappdefield = ipsappdataentity.findPSAppDEField(value);
    }
    return this.tipspsappdefield;
  }

  get tipsPSAppDEField(): IPSAppDEField | null {
    return this.getTipsPSAppDEField();
  }

  getTipsPSAppDEFieldMust(): IPSAppDEField {
    const value = this.getTipsPSAppDEField();
    if (value == null) {
      throw new Error('未指定节点提示值应用实体属性');
    }
    return value;
  }

  protected updatepsdeoppriv: IPSDEOPPriv | null = null;

  getUpdatePSDEOPPriv(): IPSDEOPPriv | null {
    if (this.updatepsdeoppriv != null) return this.updatepsdeoppriv;
    const value = this.M.getUpdatePSDEOPPriv;
    if (value == null) {
      return null;
    }
    this.updatepsdeoppriv = this.getPSModel4('dataentity.priv.IPSDEOPPriv', value, 'getUpdatePSDEOPPriv') as IPSDEOPPriv;
    return this.updatepsdeoppriv;
  }

  get updatePSDEOPPriv(): IPSDEOPPriv | null {
    return this.getUpdatePSDEOPPriv();
  }

  getUpdatePSDEOPPrivMust(): IPSDEOPPriv {
    const value = this.getUpdatePSDEOPPriv();
    if (value == null) {
      throw new Error('未指定更新要求操作标识');
    }
    return value;
  }

  get appendCaption(): boolean {
    return this.M.appendCaption != null ? this.M.appendCaption : false;
  }

  get cls(): string {
    return 'PSDETreeDataSetNodeImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'control.IPSControlMDObject' || cls == 'control.tree.IPSDETreeDataSetNode') return true;
    return super.instanceof(cls);
  }
}
